﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using ZhimeiSoft.Framework.Client.Base;
using ZhimeiSoft.Framework.Client.Utils;

namespace ZhimeiSoft.CharmManager.Client.Forms
{
    public partial class frmCustomQueryList : FormBase
    {
        /// <summary>
        /// 当窗体返回DialogResult.OK时访问此方法.
        /// </summary>
        public DataRow getCustomInfoRow{
            get
            {
                if (grvCustomInfo.FocusedRowHandle < 0)
                    return null;

                return ((DataRowView)grvCustomInfo.GetRow(grvCustomInfo.FocusedRowHandle)).Row;
            }
        }
    
    
        public frmCustomQueryList(DataTable dsCustom)
        {
            InitializeComponent();
            if (dsCustom != null)
            {
                grdCustomInfo.DataSource = dsCustom;
            }
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (grvCustomInfo.FocusedRowHandle < 0)
            {
                MsgBox.MsgInfo("请选择正确的会员信息。");
                return;
            }
            this.DialogResult = DialogResult.OK;
        }

        private void grvCustomInfo_DoubleClick(object sender, EventArgs e)
        {
            if (grvCustomInfo.FocusedRowHandle < 0)
            {
                return;
            }
            this.DialogResult = DialogResult.OK;
        }
    }
}
